<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@ include file="/commons/pages/taglibs.jsp" %>
<%@ taglib uri="http://java.fckeditor.net" prefix="FCK" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>${naviString}</title>
<link href="${ctx}/commons/styles/themes/blue/styles/style.css" rel="stylesheet" type="text/css" />
<link href="${ctx}/commons/scripts/jquery-ui/themes/redmond/jquery-ui.custom.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div align="center">
  <div align="left" style="width:99%">
    <div align="left" class="nav">${naviString}</div>
    <html-el:form action="/manager/OnlineOrder.do">
      <html-el:hidden property="method" value="save" />
      <html-el:hidden property="mod_id" />
      <html-el:hidden property="id" />
      <html-el:hidden property="queryString" />
      <br />
      <table width="100%" border="0" align="left" cellpadding="1" cellspacing="1" class="datagrid">
        <tr>
          <th colspan="2">订单处理</th>
        </tr>
        <tr>
          <td width="15%" class="title_item"><span style="color: #F00;">*</span><strong>处理方式：</strong></td>
          <td width="85%"><html-el:select property="deal_mode" styleId="deal_mode" style="width:150px">
              <html-el:option value="">请选择...</html-el:option>
              <html-el:option value="1">已付订金</html-el:option>
              <html-el:option value="2">已付全款</html-el:option>
              <html-el:option value="3">取消订单</html-el:option>
              <html-el:option value="9">其他</html-el:option>
            </html-el:select></td>
        </tr>
        <tr id="tr_dm" style="display: none;">
          <td class="title_item"><span style="color: #F00;">*</span><strong>方式说明：</strong></td>
          <td><html-el:textarea property="deal_mode_memo" styleId="deal_mode_memo" style="width:400px" />
            &nbsp;<span style="color: blue">(50字以内)</span></td>
        </tr>
        <tr>
          <td class="title_item"><strong>备忘说明：</strong></td>
          <td><html-el:textarea property="memo" styleId="memo" value="" style="width:400px" />
            &nbsp;<span style="color: blue">(500字以内)</span></td>
        </tr>
        <tr>
          <td class="title_item">&nbsp;</td>
          <td><html-el:button property="order_view" styleId="order_view" value="查看订单信息" styleClass="ui-state-default ui-corner-all" style="cursor:pointer;" />
            &nbsp;
            <html-el:button property="save" value=" 保 存 " styleId="save" styleClass="ui-state-default ui-corner-all" style="cursor:pointer;" />
            &nbsp;
            <html-el:button property="back" value=" 返 回 " onclick="history.back();" styleClass="ui-state-default ui-corner-all" style="cursor:pointer;" />
            &nbsp;
            &nbsp;&nbsp; <span id="loading" style="display:none;"><img src="${ctx}/commons/styles/images/loading.gif" style="vertical-align:middle; margin: 2px;" />数据提交中，请稍候...</span></td>
        </tr>
      </table>
    </html-el:form>
    <div id="div_od" style="display: none;">
      <table width="100%" border="0" align="left" cellpadding="1" cellspacing="1" class="datagrid">
        <tr>
          <td colspan="2"><table width="99%" border="0" align="left" cellpadding="1" cellspacing="1" class="datagrid">
              <tr class="title_tr">
                <td align="center" colspan="2">订单信息</td>
              </tr>
              <tr>
                <td width="15%" align="right"><strong>促销活动：</strong></td>
                <td width="85%">${hf.map.title}</td>
              </tr>
              <tr>
                <td align="right"><strong>客户姓名：</strong></td>
                <td>${hf.map.name}</td>
              </tr>
              <tr>
                <td align="right"><strong>客户性别：</strong></td>
                <td><c:if test="${hf.map.sex eq 0}">先生</c:if>
                  <c:if test="${hf.map.sex eq 1}">女士</c:if></td>
              </tr>
              <tr>
                <td align="right"><strong>手机号码：</strong></td>
                <td>${hf.map.mobile}</td>
              </tr>
              <tr>
                <td align="right"><strong>联系QQ：</strong></td>
                <td>${hf.map.qq}</td>
              </tr>
              <tr>
                <td align="right"><strong>送货地址：</strong></td>
                <td>${hf.map.address}</td>
              </tr>
              <tr>
                <td align="right"><strong>客户留言：</strong></td>
                <td><textarea style="border: none;width: 70%;" onfocus="this.blur()">${hf.map.memo}</textarea></td>
              </tr>
              <tr>
                <td align="right"><strong>订单时间：</strong></td>
                <td><fmt:formatDate value="${hf.map._create_time}" pattern="yyyy-MM-dd HH:mm:ss" /></td>
              </tr>
              <tr>
                <td align="right"><strong>订单总金额：</strong></td>
                <td>${hf.map.total_price}<c:if test="${not empty hf.map.total_price}">元</c:if></td>
              </tr>
              <tr>
                <td align="right"><strong>订单状态：</strong></td>
                <td><c:if test="${hf.map.state eq 0}">未处理</c:if>
		            <c:if test="${hf.map.state eq 1}">已付订金</c:if>
		            <c:if test="${hf.map.state eq 2}">已付全款</c:if>
		            <c:if test="${hf.map.state eq 3}">取消订单</c:if>
		            <c:if test="${hf.map.state eq 9}">其他</c:if>
		            <c:if test="${hf.map.state eq 99}">已归档</c:if></td>
              </tr>
              <c:if test="${hf.map.mod_id ne 2902}">
                <tr>
                  <td colspan="2"><table width="100%" border="0" align="left" cellpadding="0" cellspacing="1" class="datagrid">
                      <tr class="title_tr">
                        <td align="center" colspan="2">产品订单明细</td>
                      </tr>
                      <tr class="title_tr">
                        <td nowrap="nowrap" width="30%">产品名称</td>
                        <td nowrap="nowrap" width="60%">订购数量</td>
                      </tr>
                      <tbody id="intro_tbody">
                        <c:forEach var="cur" items="${hf.map.productDetailList}">
                          <tr id="tr_${cur.id}">
                            <td align="center">${cur.product_name}[${cur.product_model}]</td>
                            <td align="center">${cur.num}</td>
                          </tr>
                        </c:forEach>
                      </tbody>
                    </table></td>
                </tr>
              </c:if>
              <c:if test="${not empty dealInfolList}">
                <tr>
                  <td colspan="2"><table width="100%" border="0" align="left" cellpadding="0" cellspacing="1" class="datagrid">
                      <tr class="title_tr">
                        <td align="center" colspan="5">订单处理记录</td>
                      </tr>
                      <tr class="title_tr">
                        <td nowrap="nowrap" width="15%">处理人</td>
                        <td nowrap="nowrap" width="15%">处理时间</td>
                        <td nowrap="nowrap" width="15%">处理方式</td>
                        <td nowrap="nowrap" width="20%">方式说明</td>
                        <td nowrap="nowrap" width="35%">备忘说明</td>
                      </tr>
                      <tbody id="deal_tbody">
                        <c:forEach var="d_cur" items="${dealInfolList}">
                          <tr>
                            <td align="center">${d_cur.deal_user_name}</td>
                            <td align="center"><fmt:formatDate value="${d_cur.deal_time}" pattern="yyyy-MM-dd HH:mm:ss" /></td>
                            <td align="center"><c:if test="${d_cur.deal_mode eq 1}">已付订金</c:if>
                              <c:if test="${d_cur.deal_mode eq 2}">已付全款</c:if>
                              <c:if test="${d_cur.deal_mode eq 3}">取消订单</c:if>
                              <c:if test="${d_cur.deal_mode eq 9}">其他</c:if></td>
                            <td align="left">${d_cur.deal_mode_memo}</td>
                            <td align="left">${d_cur.memo}</td>
                          </tr>
                        </c:forEach>
                      </tbody>
                    </table></td>
                </tr>
              </c:if>
            </table></td>
        </tr>
      </table>
    </div>
  </div>
</div>
<script type="text/javascript" src="${ctx}/commons/scripts/validator.js"></script>
<script type="text/javascript" src="${ctx}/commons/scripts/jquery.js"></script>
<script type="text/javascript">//<![CDATA[
$(document).ready(function(){
	initStyle();
	
	$("#deal_mode").attr("datatype","Require").attr("msg","处理方式必须选择");
		
	var f = document.forms[0];
	$("#save").click(function(){
		
		if(Validator.Validate(f, 1)) {
			if($.trim($("#deal_mode_memo").val()).length > 50){
				alert("方式说明不能超过50个字。");
				return false;
			}
			if($.trim($("#memo").val()).length > 500){
				alert("备忘说明不能超过500个字。");
				return false;
			}
			
			$("#loading").show();
			$("#save").attr("disabled", "true");

			f.submit();
		}
	});
});

function initStyle(){
	$("input[type='text']").css({border: "1px solid #ccc"});
	$("input[type='submit'],input[type='reset'],input[type='button']").css({border: "1px solid"});
	$("input[type='text'][readonly],input[type='password'][readonly],textarea[readonly]").css({color:"#000"});
    $("input[type='text'],input[type='password'],textarea").not("[readonly]").focus(function(){
    	$(this).addClass("row_focus");
    }).blur(function(){
    	$(this).removeClass("row_focus");
    });
    
	$("textarea").each(function(){
		this.onpropertychange = function () {
			if (this.scrollHeight > 16) this.style.posHeight = this.scrollHeight;
		};
	});
}

$("#deal_mode").change(function(){
	if($(this).val() == 9){
		$("#tr_dm").show();
		$("#deal_mode_memo").attr("datatype","Require").attr("msg","方式说明必须填写");
	}else{
		$("#tr_dm").hide();
		$("#deal_mode_memo").removeAttr("datatype").removeAttr("msg");
	}
});

var selectedEffect = "Fold"; 
$("#order_view").toggle(function(){
	$(this).val("收起订单信息");
	$("#div_od").show(selectedEffect, null, 500, null);
},function(){
	$(this).val("查看订单信息");
	$("#div_od").hide(selectedEffect, null, 500, null);
});

//]]></script>
</body>
</html>
